// 创建一个装饰器函数
const  myDecorator=(fn)=> {
    return function() {
        console.log("头部");
        const result = fn.apply(this, arguments);
        console.log('尾部');
        return result;
    };
}

// 使用装饰器
const sayHello=(name)=> {
    return `Hello, ${name}!`;
}

// 应用装饰器
const decoratedSayHello = myDecorator(sayHello);

// 调用装饰后的函数
console.log(decoratedSayHello('Kimi'));  // 输出: Something is happening before the function is called.
//       Hello, Kimi!
//       Something is happening after the function is called.
